Centrifugal compressors are used across many industries to compress gas from a lower pressure to a higher pressure. Lower pressure gas is suctioned into the compressor via an inlet and discharged from the compressor as higher pressure gas via an outlet. In some instances, a portion of the higher pressure gas that would otherwise be discharged via the outlet may instead be diverted to a recycle valve or a blow-off valve operatively coupled to the compressor. The recycle or blow-off valve may be actuated to prevent surge based on a control algorithm executed in a controller.